﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using DTO;
using BUS;
using System.Web.Hosting;

namespace LTHD_WS
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {
        [WebMethod]
        public List<CauHoiDTO> getAllQuestions()
        {
            return CauHoiBUS.getAll();
        }
        [WebMethod]
        public CauHoiDTO getQuestionById(int maCauHoi)
        {
            return CauHoiBUS.getQuestionById(maCauHoi);
        }
        [WebMethod]
        public List<CauHoiDTO> getQuestionsByDiaDiemId(int diaDiemId)
        {
            return CauHoiBUS.getQuestionsByDiaDiemId(diaDiemId);
        }
        [WebMethod]
        public List<CommentDTO> getAllComment()
        {
            return CommentBUS.getAll();
        }
        [WebMethod]
        public List<CommentDTO> getCommentById(int id)
        {
            return CommentBUS.getCommentById(id);
        }
        [WebMethod]
        public List<CommentDTO> getCommentofComment(int commentId)
        {
            return CommentBUS.getCommentofComment(commentId);
        }
        [WebMethod]
        public List<CommentDTO> getCommentOfAccount(int taiKhoanID)
        {
            return CommentBUS.getCommentOfAccount(taiKhoanID);
        }
        [WebMethod]
        public List<CommentDTO> getCommentOfDiaDiem(int diaDiemId)
        {
            return CommentBUS.getCommentOfDiaDiem(diaDiemId);
        }
        [WebMethod]
        public bool insertComment(CommentDTO cm)
        {
            return CommentBUS.insertComment(cm);
        }

        //le code
        [WebMethod]
        public List<DiaDiemDTO> getAllDiaDiem2(string ask)
        {
            return DiaDiemBUS.getAllDiaDiem2(ask);
        }
        //end

        [WebMethod]
        public List<DiaDiemDTO> getAllDiaDiem()
        {
            return DiaDiemBUS.getAllDiaDiem();
        }
        [WebMethod]
        public DiaDiemDTO getDiaDiemById(int id)
        {
            return DiaDiemBUS.getDiaDiemById(id);
        }
        [WebMethod]
        public List<DiaDiemDTO> getDiaDiemByAccount(int accountId, int share)
        {
            return DiaDiemBUS.getDiaDiemByAccount(accountId,share);
        }
        [WebMethod]
        public bool insertDiaDiem(DiaDiemDTO d)
        {
            return DiaDiemBUS.insertDiaDiem(d);
        }
        [WebMethod]
        public bool updateDiaDiem(DiaDiemDTO d)
        {
            return DiaDiemBUS.updateDiaDiem(d);
        }
        [WebMethod]
        public List<TaiKhoanDiaDiemDTO> getAllAccount_DiaDiem()
        {
            return TaiKhoanDiaDiemBUS.getAllAccount_DiaDiem();
        }
        [WebMethod]
        public bool insertAccount_DiaDiem(TaiKhoanDiaDiemDTO td)
        {
            return TaiKhoanDiaDiemBUS.insertAccount_DiaDiem(td);
        }

        [WebMethod]
        public List<KetQuaDTO> getAllResult()
        {
            return KetQuaBUS.getAllResults();
        }
        [WebMethod]
        public KetQuaDTO getResultById(int id)
        {
            return KetQuaBUS.getResultById(id);
        }
        [WebMethod]
        public List<KetQuaDTO> getResultsByAccountId(int maTaiKhoan)
        {
            return KetQuaBUS.getResultsByAccountId(maTaiKhoan);
        }
        [WebMethod]
        public List<KetQuaDTO> getResultsByQuestionId(int maCauHoi)
        {
            return KetQuaBUS.getResultsByQuestionId(maCauHoi);
        }
        [WebMethod]
        public bool insertResult(KetQuaDTO kq)
        {
            return KetQuaBUS.insertResult(kq);
        }

        [WebMethod]
        public List<TaiKhoanDTO> getAllAccounts()
        {
            return TaiKhoanBUS.getAllAccounts();
        }
        [WebMethod]
        public TaiKhoanDTO getAccountByTen(string tenDangNhap)
        {
            return TaiKhoanBUS.getAccountByTen(tenDangNhap);
        }
        [WebMethod]
        public TaiKhoanDTO logIn(string tenDangNhap, string matKhau)
        {
            return TaiKhoanBUS.logIn(tenDangNhap, matKhau);
        }
        [WebMethod]
        public bool isExistAccount(string _username)
        {
            return TaiKhoanBUS.isExistAccount(_username);
        }
        [WebMethod]
        public bool insertAccount(TaiKhoanDTO tk)
        {
            return TaiKhoanBUS.insertAccount(tk);
        }
        [WebMethod]
        public bool updateAccount(TaiKhoanDTO tk)
        {
            return TaiKhoanBUS.updateAccount(tk);
        }
        [WebMethod]
        public bool deleteAccountByTk(TaiKhoanDTO tk)
        {
            return TaiKhoanBUS.deleteAccount(tk);
        }
        [WebMethod]
        public bool deleteAccount(string _username)
        {
            return TaiKhoanBUS.deleteAccount(_username);
        }


        [WebMethod]
        public List<RssDTO> getAllRss()
        {
            return RssBUS.getAllRss();
        }
    }
}